{include file="common/header.tpl"}
{if $AppUI->id <= 0}
	{include file="index/login.tpl"}  
{else}
	{include file="common/menu.tpl"}
    <div class="rightColumn">
    	<div class="boxContent">
        	<div class="contentItem">
                <div class="contentItems">
                	<div class="headerTitle"><h2><a href="{$smarty.const.HOST_BACKEND}product/index">Trường học</a> &raquo; Album slideshow{if isset($smarty.session.slideshow) && (($smarty.session.slideshow&1<<1) > 0)} &raquo; <a href="{$smarty.const.HOST_BACKEND}product/upload">Thêm mới</a>{/if}</h2></div> 
                    <form name="frmSearch" id="frmSearch" action="{$smarty.const.HOST_BACKEND}product/album" method="get" enctype="multipart/form-data">
	                	{include file="product/album-stt.tpl"}
                    </form>
                    <form name="frmSlideshow" id="frmSlideshow" action="{$smarty.const.HOST_BACKEND}product/actalbum" method="post" enctype="multipart/form-data">
                    	<input type="hidden" name="paction" id="paction"/>
                        <input type="hidden" name="pbackurl" id="pbackurl" value="{$smarty.const.HOST_BACKEND}product/album"/>
                        <div class="secData">
                            {if $arrResult}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                        {if isset($smarty.session.slideshow)}     
                                            {if ($smarty.session.slideshow&1<<4) > 0}
                                                <input type="button" onclick="javascript:confirmPending(this.form);" value="Tạm dừng"/>
                                            {/if}  
                                            {if ($smarty.session.slideshow&1<<5) > 0}
                                                <input type="button" onclick="javascript:confirmActive(this.form);" class="btnLarge" value="Kích hoạt / Phục hồi"/>
                                            {/if}                                                                                   
                                            {if ($smarty.session.slideshow&1<<3) > 0}  
                                                <input type="button" onclick="javascript:confirmDelete(this.form);" value="Xóa"/>
                                            {/if}
                                        {else}
                                            &nbsp;
                                        {/if}
                                    </div>
                                    <div class="totalPage"><strong>Tổng số: {$intTotal}</strong></div>
                                </div>
                            {/if}
                            <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        {if $arrResult && isset($smarty.session.slideshow) && ( (($smarty.session.slideshow&1<<3)>0) || (($smarty.session.slideshow&1<<4)>0) )}
                                            <th class="firstChild" width="30"><input type="checkbox" name="pcheckall" id="pcheckall" onclick="javascript:checkAll(this.form,'palbumid[]',this.checked);"/></th>
                                            <th width="130">Hình trong album</th>
                                        {else}
                                            <th class="firstChild" width="130">Hình trong album</th>
                                        {/if}                                       
                                        <th>Tiêu đề</th>
                                        <th width="100">Tổng hình</th>
                                        <th width="80">Tình trạng</th>
                                        <th width="80">Ngày đăng</th>
                                        {if $arrResult && isset($smarty.session.slideshow)}
                                            <th width="50">&nbsp;</th>
                                        {/if}
                                    </tr>
                                </thead>
                                <tbody>
                                    {if $arrResult}
                                        {foreach item=item from=$arrResult}
                                            <tr class="{cycle values="odd,even"}">
                                                {if isset($smarty.session.slideshow) && ((($smarty.session.slideshow&1<<3)>0) || (($smarty.session.slideshow&1<<4)>0))}
                                                    <td class="firstChild" align="center">
                                                        <input type="checkbox" id="palbumid{$item.albumid}" name="palbumid[]" value="{$item.albumid}" onclick="javascript:checkOneItem(this.form, 'pcheckall')"/>
                                                    </td>
                                                    <td>
                                                    	{if $item.image != ""}
                                                    		{image path=$item.image type=12 small=1 attr="style=\"width:130px;\""}
                                                        {else}-----//------{/if}
                                                   	</td>
                                                {else}
                                                    <td class="firstChild">
                                                    	
                                                    	{if $item.image != ""}
                                                    		{image path=$item.image type=9 small=1 attr="style=\"width:130px;\""}
                                                        {else}-----//------{/if}
                                                    </td>
                                                {/if}
                                                <td>
                                                    {$item.name}                       
                                                </td>    
                                                <td align="right">{$item.timage}</td>                                            
                                                <td align="center">
                                                	{if $item.status == 0}
                                                    	<img src="{$smarty.const.HOST_STATICS}img/icon/ad-unaccept.png" width="16" height="" alt="Tạm dừng" border="0" title="Tạm dừng" />
                                                    {elseif $item.status == 1}
                                                    	 <img src="{$smarty.const.HOST_STATICS}img/icon/ad-accept.png" alt="Đang kích hoạt" border="0" width="16" height="16" />
                                                    {elseif $item.status == 2}
                                                    	<img src="{$smarty.const.HOST_STATICS}img/icon/ad-cancel.png" alt="Bị xóa" border="0" width="16" height="16" />
                                                    {/if}
                                                </td>
                                                <td align="center">{$item.postdate|date_format:"%d/%m/%Y"}<br/>{$item.postdate|date_format:"%H:%M:%S"}</td>
                                                <td align="center">
                                               
                                                    {if isset($smarty.session.slideshow)} 
                                                    	{if ($smarty.session.slideshow&1<<1)>0}
                                                            <a href="{$smarty.const.HOST_BACKEND}product/upload?form=1&amp;albumid={$item.albumid}" title="Upload hình">
                                                                <img src="{$smarty.const.HOST_STATICS}img/icon/ad-attach.png" alt="Upload" border="0" width="16" height="16" />
                                                            </a>
                                                        {/if}                                                   	
                                                        {if ($smarty.session.slideshow&1<<2)>0}
                                                            <a href="{$smarty.const.HOST_BACKEND}product/upload?form=2&amp;albumid={$item.albumid}" title="Cập nhật thông tin">
                                                                <img src="{$smarty.const.HOST_STATICS}img/icon/ad-edit.png" alt="Edit" border="0" width="16" height="16" />
                                                            </a>
                                                        {/if}
                                                    {else}
                                                        &nbsp;
                                                    {/if}
                                                </td>
                                            </tr>
                                        {/foreach}
                                    {else}
                                        <tr><td colspan="7" align="center">Không có dữ liệu</td></tr>
                                    {/if}
                                </tbody>
                            </table>
                            {if $arrResult}
                                <div class="secActionAndPage">
                                    <div class="actionLink">
                                        {if isset($smarty.session.slideshow)}     
                                            {if ($smarty.session.slideshow&1<<4) > 0}
                                                <input type="button" onclick="javascript:confirmPending(this.form);" value="Tạm dừng"/>
                                            {/if} 
                                            {if ($smarty.session.slideshow&1<<5) > 0}
                                                <input type="button" onclick="javascript:confirmActive(this.form);" class="btnLarge" value="Kích hoạt / Phục hồi"/>
                                            {/if}  
                                            {if ($smarty.session.slideshow&1<<3) > 0}  
                                                <input type="button" onclick="javascript:confirmDelete(this.form);" value="Xóa"/>
                                            {/if}
                                        {else}
                                            &nbsp;
                                        {/if}
                                    </div>
                                    {paging total=$intTotal limit=$intLimit offset=$intOffset url=$strUrl}
                                </div>
                            {/if}
                        </div>
                	</form>                    
                </div>
          	</div>
        </div>
    </div>
{/if}
{include file="common/footer.tpl"}
                
